#ifndef CAPPMODEL_H_
#define CAPPMODEL_H_

#include "CommonType.h"

#define APPMODEL()	(CAppModel::Instance())
#define CabinetID() (APPMODEL()->CabinetInfo().id)

class CAppModel
{
public:
	static CAppModel* Instance();

    void ReadConfiguration();
    void WriteConfiguration();

    inline void SetConfig(const zl::AppConfig& config) { config_ = config; }
	inline zl::AppConfig Config() { return config_; }

    inline void SetCabinetInfo(const zl::CabinetInfo& cabinfo) { config_.cabinet = cabinfo; }
    inline zl::CabinetInfo CabinetInfo() { return config_.cabinet; }

    inline void SetTimeout(const zl::TimeoutItl& ttl) { config_.timeout = ttl; }
    inline zl::TimeoutItl Timeout() { return config_.timeout; }

    inline void SetPaymentCfg(const zl::PaymentConf& conf) { config_.payment = conf; }
    inline zl::PaymentConf PaymentCfg() { return config_.payment; }

    inline void SetZLBaseCfg(const zl::ZLBaseConfig& cfg) { base_config_ = cfg; }
    inline zl::ZLBaseConfig ZLBaseCfg() { return base_config_; }

    int32_t GetLockersPaymentInfo(int32_t t);

protected:
    CAppModel() = default;
    ~CAppModel() = default;

private:
    static CAppModel*	Instance_;

	zl::AppConfig		config_;
    zl::ZLBaseConfig    base_config_;
};

#endif // CAPPMODEL_H_
